#pragma once
#ifndef __Q__ENV__PATH__HH__
#define __Q__ENV__PATH__HH__

#include "QEnvPrereqs.h"
#include <ostream>

class QEnvPath;
extern std::ostream& operator << ( std::ostream&, const QEnvPath& path );

class QEnvPath
{
	friend std::ostream& operator << ( std::ostream&, const QEnvPath& path );
protected:
	String m_path;
public:
	static QEnvPath Invalid;
	static String Separator;

	void clean( );
	String clean( String str) const;
	
	QEnvPath( void );
	QEnvPath( const String &path );
	QEnvPath( const QEnvPath& rk );
	String makeRelative( const QEnvPath &parent ) const;
	String& operator->( );
	String& operator*( );

	QEnvPath& operator = ( const String &path );
	QEnvPath& operator = ( const std::string &path );
	QEnvPath& operator = ( const char *path );
	QEnvPath& operator = ( const QEnvPath& rk );
	
	QEnvPath operator+( const QEnvPath& p ) const;
	QEnvPath operator+( const char * p ) const;
	QEnvPath operator+( const String& p ) const;
	QEnvPath operator+( const std::string& p ) const;
	
	QEnvPath& operator+=( const QEnvPath& p );
	QEnvPath& operator+=( const char* p );
	QEnvPath& operator+=( const String& p );
	QEnvPath& operator+=( const std::string& p );
	
	QEnvPath rootDir() const;
	QEnvPath parentDir() const;
	operator QString() const;
	operator std::string() const;
	operator String() const;
	const String& path() const;

	size_t size() const;

	bool empty() const;
	bool exists() const;
	
	bool isDir() const;
	bool isFile() const;

	friend std::ostream& operator << ( std::ostream&, const QEnvPath& path );
	
	operator bool() const;

	bool operator == ( const QEnvPath& rk ) const;
	bool operator != ( const QEnvPath& rk ) const;
	
	String extension() const;
	String dirName( ) const;
	String fileName( bool with_ext = true ) const;
};
#endif